import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { Tooltip } from 'antd';
import { TableC } from '../../../../comps';

@connect(({ valuationAnalysisM, loading }) => ({
  valuationAnalysisM,
  tableLoading: loading.effects['valuationAnalysisM/getAbnormalData'],
}))
export default class AbnormalData extends PureComponent {
  state = {
    dataSource: [], // 表格数据
    columns: [
      {
        key: 'applicantTime',
        title: '申请时间',
        type: 'date',
        formatStr: 'YYYY-MM-DD HH:mm:ss',
        width: 200,
      },
      {
        key: 'applicant',
        title: '申请人',
        width: 150,
      },
      {
        key: 'fileName',
        title: '失败文件名',
      },
      {
        key: 'failReason',
        title: '失败原因',
        width: 150,
      },
    ], // 表头
  };
  componentDidMount() {
    this.getTableData();
  }
  // 获取表格数据
  getTableData = () => {
    const { dispatch } = this.props;
    dispatch({
      type: 'valuationAnalysisM/getAbnormalData',
      payload: {},
      callback: (type, data) => {
        if (type == 'success') {
          this.setState({
            dataSource: data.dataSource,
          });
        }
      },
    });
  };

  render() {
    const { dataSource, columns } = this.state;
    const { tableLoading } = this.props;
    return <TableC columns={columns} dataSource={dataSource} loading={tableLoading} scroll={{ y: '300px' }} rowKey='id' hidePage={true} />;
  }
}
